package com.demo.travel.activity;

import android.view.View;
import android.widget.ImageView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.demo.travel.R;
import com.demo.travel.adapter.RestaurantAdapter;
import com.demo.travel.base.BaseActivity;
import com.demo.travel.bean.ItemBean;

import butterknife.BindView;
import butterknife.OnClick;

public class RestaurantActivity extends BaseActivity {

    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;

    @BindView(R.id.backIv)
    ImageView backIv;

    private RestaurantAdapter restaurantAdapter;

    @Override
    protected int initLayout() {
        return R.layout.activity_restaurant;
    }

    @Override
    protected void initView() {
        backIv.setVisibility(View.VISIBLE);
        restaurantAdapter = new RestaurantAdapter();
        recyclerview.setLayoutManager(new LinearLayoutManager(this));
        recyclerview.setAdapter(restaurantAdapter);

        ItemBean itemBean1 = new ItemBean(getStringText(R.string.chi1_title), R.mipmap.chi_1);
        itemBean1.setContent(getStringText(R.string.chi1_content));
        ItemBean itemBean2 = new ItemBean(getStringText(R.string.chi2_title), R.mipmap.chi_2);
        itemBean2.setContent(getStringText(R.string.chi2_content));
        ItemBean itemBean3 = new ItemBean(getStringText(R.string.chi3_title), R.mipmap.chi_3);
        itemBean3.setContent(getStringText(R.string.chi3_content));
        ItemBean itemBean4 = new ItemBean(getStringText(R.string.chi4_title), R.mipmap.chi_4);
        itemBean4.setContent(getStringText(R.string.chi4_content));
        ItemBean itemBean5 = new ItemBean(getStringText(R.string.chi5_title), R.mipmap.chi_5);
        itemBean5.setContent(getStringText(R.string.chi5_content));
        ItemBean itemBean6 = new ItemBean(getStringText(R.string.chi6_title), R.mipmap.chi_6);
        itemBean6.setContent(getStringText(R.string.chi6_content));

        restaurantAdapter.addData(itemBean1);
        restaurantAdapter.addData(itemBean2);
        restaurantAdapter.addData(itemBean3);
        restaurantAdapter.addData(itemBean4);
        restaurantAdapter.addData(itemBean5);
        restaurantAdapter.addData(itemBean6);
    }

    @Override
    protected void initData() {

    }

    @Override
    public String getActivityTitle() {
        return "餐厅";
    }


    @OnClick(R.id.backIv)
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.backIv:
                finish();
                break;
        }
    }

}
